var roleHario = {
    run: function(creep) {
        // //creep.say(creep.memory.building);
        // var targetsgo = creep.room.find(FIND_STRUCTURES, {
        //         filter: (structure) => {
        //             return structure.structureType == STRUCTURE_CONTAINER;
        //         }
        // });
        // if(targetsgo.length > 0) {
        //         creep.moveTo(targetsgo[0]);
        //         //creep.say('采去');
        //         if(creep.pos.isEqualTo(targetsgo[0].pos)){
        //             const target = creep.pos.findClosestByRange(FIND_SOURCES_ACTIVE);
        //             if(target) {
        //                 creep.harvest(target);
        //                 //creep.say('开采');
        //             }
        //         }
        // }
        
        //升级为LINK逻辑逻辑逻辑
        //传送模式
        if(creep.store.getFreeCapacity() > 0) {
            var sources = creep.room.find(FIND_SOURCES);
            if(creep.harvest(sources[1]) == ERR_NOT_IN_RANGE) {
                creep.moveTo(sources[1], {visualizePathStyle: {stroke: '#ffaa00'}});
            }
        }
        else {
            if(creep.transfer(Game.rooms['E9S58'].lookForAt('structure',35, 26)[0], RESOURCE_ENERGY) == ERR_NOT_IN_RANGE) {
                creep.moveTo(Game.rooms['E9S58'].lookForAt('structure',35, 26)[0], {visualizePathStyle: {stroke: '#ffffff'}});
            }
        }


	}
};

module.exports = roleHario;